#pragma warning(disable : 4996)
#include"game.h"
void menu(void)
{
	printf("*************************\n");
	printf("********  1.play  *******\n");
	printf("********  2.exit  *******\n");
	printf("*************************\n");
}

void prepare(char arr[ROWS][LINS], int row, int lin)
{
	for (int i = 0; i <=row+1; i++)
	{

		for (int j = 0; j <=lin+1; j++)
		{
			arr[i][j] = '*';
		}
	}
}


void print(char arr[ROWS][LINS], int row, int lin)
{
	for (int n = 1; n <= lin; n++)
	{
		if (n == 1)
			printf("  %d  ", n);
		else
			printf(" %d  ", n);
	}
	printf("\n");
	for (int i = 1; i <=row; i++)
	{
		printf("%d", i);
		for (int j = 1; j <= lin; j++)
		{
			if (j != lin )
			{
				printf(" %c |", arr[i][j]);
			}
			else
			{
				printf(" %c \n", arr[i][j]);
				for (int k = 1; k <=row; k++)
				{
					if (k == 1)
					{
						printf(" ---|");
					}
					else if (k != row &&k!=1)
					{
						printf("---|"); 
					}
					else
					{
						printf("---\n");
					}
				}
			}

		}
	}
}




void mine(char arr1[ROWS][LINS], int row, int lin)
{
	for (int i = 0; i <=row+1; i++)
	{
		for (int j = 0; j <=lin+1; j++)
		{
				arr1[i][j] = '0';
		}
	}
	int count = 0;
	while (count != 10)
	{
		int x = rand() % 9 + 1;
		int y = rand() % 9 + 1;
		if (arr1[x][y] != '#')
		{
			arr1[x][y] = '#';
			count++;
		}
	}
}


int judge(char arr1[ROWS][LINS], int x, int y, int row, int lin)
{
	int count = 0;
	if (arr1[x][y] == '#')
	{
		return -1;
	}
	for (int i = x - 1; i <= x + 1; i++)
	{
		for (int j = y - 1; j <=y + 1; j++)
		{
			if (arr1[i][j] == '#')
			{
				count++;
			}
		}
	}
	return count;
}


void show(char arr[ROWS][LINS], int x, int y, int ret)
{
	arr[x][y] = ret+48;
}